<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="java.util.List"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>MyDaily首页</title>
		<link rel="stylesheet" type="text/css" href="layui-v2.6.8/layui/css/layui.css" />
		<style type="text/css">
			.layui-layout-body {
				overflow-y: auto;
			}

			#type {
				margin-top: 30px;
				width: 150px;
				height: 40px;
				border: 0px;
				border-radius: 5px;
				text-align: center;
				background-color: #009688;
				color: white;
			}
		</style>
	</head>
	<body>
		<div class="layui-layout layui-layout-admin">
			<div class="layui-header">
				<div class="layui-logo layui-hide-xs layui-bg-black"><%=session.getAttribute("name").toString() %>的MyDaily</div>
				<!-- 头部区域（可配合layui 已有的水平导航） -->
				<ul class="layui-nav layui-layout-left">
					<li class="layui-nav-item layui-hide-xs"><a href="" id="my" style="color: #009688;">写日记</a></li>
					<li class="layui-nav-item layui-hide-xs"><a href="PageServlet?sid=1" id="my">我的日记</a></li>
					<li class="layui-nav-item layui-hide-xs"><a href="PiceterServlet">我的相册</a></li>
					<li class="layui-nav-item layui-hide-xs"><a href="">我的性格</a></li>
					<li class="layui-nav-item">
						<a href="javascript:;">更多</a>
						<dl class="layui-nav-child">
							<dd><a href="#" onclick="if(window.confirm('很抱歉，该功能暂未开放，敬请等待,')==false) return false">记事本</a></dd>
							<dd><a href="" onclick="if(window.confirm('很抱歉，该功能暂未开放，敬请等待,')==false) return false">备忘录</a></dd>
						</dl>
					</li>
				</ul>
				<ul class="layui-nav layui-layout-right">
					<li class="layui-nav-item layui-hide layui-show-md-inline-block">
						<a href="" id="geren">
							<img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" class="layui-nav-img">
							个人中心
						</a>
					</li>
					<li class="layui-nav-item layui-hide layui-show-md-inline-block">
						<a href="javascript:;">设置</a>
						<dl class="layui-nav-child">
							<dd><a href=""></a></dd>
							<dd><a href="#" id="moshi" onclick="qiehuan()">日间模式</a></dd>
							<dd><a href="userQuit">退出</a></dd>
						</dl>
					</li>
				</ul>
			</div>

			<div class="layui-side layui-bg-black">
				<div class="layui-side-scroll">
					<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
					<ul class="layui-nav layui-nav-tree" lay-filter="test">
						<li class="layui-nav-item layui-nav-itemed">
							<a class="" href="javascript:;">历史日记</a>
							<dl class="layui-nav-child">
								<dd><a href="PageServlet?sid=2">最近一周</a></dd>
								<dd><a href="PageServlet?sid=3">最近一月</a></dd>
								<dd><a href="PageServlet?sid=4">最近一年</a></dd>
								<dd><a href="PageServlet?sid=5">更久</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item">
							<a href="javascript:;">历史相册</a>
							<dl class="layui-nav-child">
								<dd><a href="javascript:;">最近一周</a></dd>
								<dd><a href="javascript:;">最近一月</a></dd>
								<dd><a href="javascript:;">最近一年</a></dd>
								<dd><a href="">更久</a></dd>
							</dl>
						</li>
					</ul>
				</div>
			</div>

			<div class="layui-body">
				<!-- 内容主体区域 -->
				<div style="padding: 15px;">
					<span style="font-size: 25px;">友情提示，该系统现在处于试用期，有些功能还未完善。<br>
						</span>
					<div id="test">
						<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
							<legend>今天有开心事吗？快把他记录下来吧</legend>
						</fieldset>
						<form action="keepDiaryServlet" method="post">
							<textarea class="layui-textarea" id="LAY_demo1" style="display: none;color: white;" name="text"></textarea>
							<br>
							<span style="font-size: 20px;color:blue;">
							<%
 							if (request.getAttribute("msg") != null) {
 								%>
 								 <%=request.getAttribute("msg")%> <%
 							}
 								%>
							<br>
							<select name="type" id="type">
								<option value="未选择类型">选择日记类型</option>
								<option value="日常">日常</option>
								<option value="旅游">旅游</option>
								<option value="学习">学习</option>
								<option value="不开心">烦躁</option>
								<option value="有趣">有趣</option>
							</select>
							<input type="submit" value="记录" class="layui-btn site-demo-layedit" data-type="text" style="width: 100px;margin-left: 20px;" />
					</div>
					</form>
				</div>
			</div>
		</div>

		</div>
		<script src="layui-v2.6.8/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script>
			//JS
			layui.use(['element', 'layer', 'util'], function() {
				var element = layui.element,
					layer = layui.layer,
					util = layui.util,
					$ = layui.$;

				//头部事件
				util.event('lay-header-event', {
					//左侧菜单事件
					menuLeft: function(othis) {
						layer.msg('展开左侧菜单的操作', {
							icon: 0
						});
					},
					menuRight: function() {
						layer.open({
							type: 1,
							content: '<div style="padding: 15px;">处理右侧面板的操作</div>',
							area: ['260px', '100%'],
							offset: 'rt' //右上角
								,
							anim: 5,
							shadeClose: true
						});
					}
				});

			});

			// 富文本
			layui.use('layedit', function() {
				var layedit = layui.layedit,
					$ = layui.jquery;

				//构建一个默认的编辑器
				var index = layedit.build('LAY_demo1');

				  
				//编辑器外部操作
				var active = {
					content: function() {
						alert(layedit.getContent(index)); //获取编辑器内容
					},
					text: function() {
						// alert(layedit.getText(index)); //获取编辑器纯文本内容
					},
					selection: function() {
						alert(layedit.getSelection(index));
					}
				};

				$('.site-demo-layedit').on('click', function() {
					var type = $(this).data('type');
					active[type] ? active[type].call(this) : '';
				});

				//自定义工具栏
				layedit.build('LAY_demo2', {
					tool: ['face', 'link', 'unlink', '|', 'left', 'center', 'right'],
					height: 100
				})
			});
			
			// 日间/夜间切换
			function qiehuan() {
				alert("很抱歉，该功能暂未开放，敬请等待")
			}
		</script>
	</body>
</html>